$(function(){
	street_change();
});
function street_change()
{
	$("#street").on('change', function(){
		var street_id = $(this).val();
		getCommunity(street_id);
	});
}
function getCommunity(street){
	$.ajax({ 
		url: "/admin/word/getCommunity", 
		dataType: "json",
		data:{street_id:street},
		type: "get",
		success: function(data){
			var html = [];
			html.push('<option value="0">请选择社区</option>');
			var len = data.length;
			for(var i= 0;i<len; i++) {
				html.push('<option value="'+data[i].id+'">'+data[i].name);
				html.push('</option>');
				
			}
			$("#community").html(html.join(''));
	    },
	    error: function(){
	    	alert("数据请求出错了,请刷新页面");
	    }
    });
}